<div class="cars view">
    <h2 class="left"><?php __('Auto'); ?></h2>
    <div class="actions specific">
        <h3><?php __('Opciones'); ?></h3>
        <ul>
            <li><?php 
            if(sizeof($car['Key']) == 0){
                echo $this->Html->link(__('Agregar Llave', true), array('action' => 'agregar_llave', $car['Car']['id']));
            } ?></li>
            <li><?php echo $this->Html->link(__('Cambiar Titular', true), array('action' => 'cambio_titular', $car['Car']['id'])); ?> </li>
            <li><?php echo $this->Html->link(__('Editar Auto', true), array('action' => 'edit', $car['Car']['id'])); ?> </li>
            <li><?php echo $this->Html->link(__('Eliminar Auto', true), array('action' => 'delete', $car['Car']['id']), null, sprintf(__('Esta seguro que desea eliminar el auto # %s?', true), $car['Car']['letter'] . ' ' . $car['Car']['number'])); ?> </li>
        </ul>
    </div>
    <br />
    <br />
    <br />
    <dl><?php $i = 0;
$class = ' class="altrow"'; ?>
        <dt<?php if ($i % 2 == 0)
            echo $class; ?>><?php __('Id'); ?></dt>
        <dd<?php if ($i++ % 2 == 0)
                echo $class; ?>>
                <?php echo $car['Car']['id']; ?>
            &nbsp;
        </dd>
        <dt<?php if ($i % 2 == 0)
                    echo $class; ?>><?php __('Letra'); ?></dt>
        <dd<?php if ($i++ % 2 == 0)
                echo $class; ?>>
                <?php echo $car['Car']['letter']; ?>
            &nbsp;
        </dd>
        <dt<?php if ($i % 2 == 0)
                    echo $class; ?>><?php __('Numero'); ?></dt>
        <dd<?php if ($i++ % 2 == 0)
                echo $class; ?>>
                <?php echo $car['Car']['number']; ?>
            &nbsp;
        </dd>
        <dt<?php if ($i % 2 == 0)
                    echo $class; ?>><?php __('Marca'); ?></dt>
        <dd<?php if ($i++ % 2 == 0)
                echo $class; ?>>
                <?php echo $car['Car']['mark']; ?>
            &nbsp;
        </dd>
        <dt<?php if ($i % 2 == 0)
                    echo $class; ?>><?php __('Modelo'); ?></dt>
        <dd<?php if ($i++ % 2 == 0)
                echo $class; ?>>
                <?php echo $car['Car']['model']; ?>
            &nbsp;
        </dd>
        <dt<?php if ($i % 2 == 0)
                    echo $class; ?>><?php __('N° Chasis'); ?></dt>
        <dd<?php if ($i++ % 2 == 0)
                echo $class; ?>>
                <?php echo $car['Car']['chassis_number']; ?>
            &nbsp;
        </dd>
        <dt<?php if ($i % 2 == 0)
                    echo $class; ?>><?php __('Titular'); ?></dt>
        <dd<?php if ($i++ % 2 == 0)
                echo $class; ?>>
                <?php echo $this->Html->link($car['Client']['last_name'] . ' ' . $car['Client']['first_name'], array('controller' => 'clients', 'action' => 'view', $car['Client']['id'])); ?>
            &nbsp;
        </dd>
    </dl>
</div>
<div class="keys index">
    <h2><?php __('Llave'); ?></h2>
    <table cellpadding="0" cellspacing="0">
        <tr>
<!--			<th><?php echo 'Id'; ?></th>-->
            <th><?php echo 'Marca'; ?></th>
            <th><?php echo 'Modelo'; ?></th>
            <th><?php echo 'Chip'; ?></th>
            <th><?php echo 'Codigo'; ?></th>
            <th><?php echo 'Estilo'; ?></th>
<!--			<th><?php echo 'Auto'; ?></th>-->
            <th class="actions"><?php __('Opciones'); ?></th>
        </tr>
        <?php
        $i = 0;
        foreach ($car['Key'] as $key):
//            pr($car);die;
            $class = null;
            if ($i++ % 2 == 0) {
                $class = ' class="altrow"';
            }
            ?>
            <tr<?php echo $class; ?>>
    <!--		<td><?php echo $key['id']; ?>&nbsp;</td>-->
                <td><?php echo $key['mark']; ?>&nbsp;</td>
                <td><?php echo $key['model']; ?>&nbsp;</td>
                <td><?php echo $key['chip']; ?>&nbsp;</td>
                <td><?php echo $key['code']; ?>&nbsp;</td>
                <td><?php echo $key['style']; ?>&nbsp;</td>
    <!--		<td>
                <?php echo $this->Html->link($car['Car']['mark'] . ' ' . $car['Car']['model'], array('controller' => 'cars', 'action' => 'view', $key['id'])); ?>
                </td>-->
                <td class="actions">
                    <?php echo $this->Html->link(__('Ver', true), array('controller' => 'keys', 'action' => 'view', $key['id'])); ?>
                    <?php echo $this->Html->link(__('Agregar Copia', true), array('controller' => 'keys', 'action' => 'agregar_copia', $key['id'])); ?>
                    <?php echo $this->Html->link(__('Editar', true), array('controller' => 'keys', 'action' => 'edit', $key['id'])); ?>
                    <?php echo $this->Html->link(__('eliminar', true), array('controller' => 'keys', 'action' => 'delete', $key['id']), null, sprintf(__('Esta seguro que desea eliminar la llave # %s?', true), $key['mark'].'-'.$key['model'])); ?>
                </td>
            </tr>
        <?php endforeach; ?>
    </table>
</div>